<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>焦点事件案例</title>
    <script>
        var note;
        function myfocus(fname,notename) {
            note = document.getElementById(notename);
            note.innerText=fname+'获得焦点，开始输入'
        }
        function myblur(fname,notename) {
            note = document.getElementById(notename);
            note.innerText=fname+'获得焦点，开始输入'
        }
    </script>
</head>
<body>
    <form action="" name="myform">
        <input type="text" name="uname" onfocus="myfocus('uname','unote')" onblur="myblur('uname','unote')">
        <font id="unote"></font><br>
        <input type="text" name="pwd" onfocus="myfocus('pwd','pnote')" onblur="myblur('pwd','pnote')">
        <font id="pnote"></font>
    </form>
</body>
</html>